package com.ai.cmdc.codeutil.java_generator;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhoulk
 * @Description:
 * @date: 2019/8/5
 */
@Data
public class GeneratorConfig {
    private String targetProject; //项目路径
    private String author;
    private List<Service> services = new ArrayList<>();

    GeneratorConfig author(String str) {
        this.author = str;
        return this;
    }

    /**
     * 类
     */
    @Data
    public class Service {
        private String targetProject; //项目路径，为空时使用默认路径
        private String serviceRemark; //类注释
        private String apiPack; //api接口所在包
        private String controllerPack; //controller所在包
        private String servicePack; //服务类所在包
        private String implPack; //服务实现类所在包
        private String serviceName; //类名
        private String implName; //实现类名
        private boolean isController; //是否为Controller
        private String url; //url
        private List<Function> functions = new ArrayList<>(); //方法列表
    }

    /**
     * 方法
     */
    @Data
    class Function {
        private String functionRemark; //方法注释
        private String functionName; //方法名
        private String url; //路径
        private String method; //请求方法
        private List<Entity> iDTos = new ArrayList<>(); //入参列表
        private Entity oDTo; //出参列表
    }

    @Data
    class Entity {
        String entityTarget; //实体所在项目路径
        String entityPack; //实体包路径
        String entityName; //实体名
        private boolean basis; //是否基础数据类型
        private boolean create; //是否需要创建
        private boolean list; //是否为List
        String annotionPack; //注解路径
        String annotionStr; //注解
        String paramName; //参数命名
    }


}
